package com.stars.entity.sys;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.stars.common.base.entity.BaseAppEntity;
import com.stars.common.date.DateUtil;
import com.stars.common.valid.AddView;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 用户
 */

@Data
@Table(name = "SYSTEM_USER")
public class SystemUser extends BaseAppEntity {
    /**
     * 用户名
     */
    @NotNull(groups = {AddView.class},message="用户名不能为空!")
    @Column(name = "USER_NAME")
    private String userName;

    /**
     * 用户密码
     */
    @JsonIgnore
    @NotNull(groups = {AddView.class},message="密码不能为空!")
    @Column(name = "USER_PASSWORD")
    private String userPassword;

    /**
     * 盐
     */
    @JsonIgnore
    @Column(name = "USER_SALT")
    private String userSalt;

    /**
     * 盐2
     */
    @JsonIgnore
    @Column(name = "USER_SALT2")
    private String userSalt2;

    /**
     * 添加用户时间
     */
    @Column(name = "USER_ADD_TIME")
    private Long userAddTime = DateUtil.getNewTime();

    /**
     * 用户真实姓名
     */
    @NotNull(groups = {AddView.class},message="真实姓名不能为空!")
    @Column(name = "USER_REAL_NAME")
    private String userRealName;

    /**
     * 电话号码
     */
    @NotNull(groups = {AddView.class},message="电话号码不能为空!")
    @Column(name = "USER_PHONE")
    private String userPhone;

    /**
     * 是否启用(0=启用，1=禁用)
     */
    @Column(name = "USER_ENABLED")
    private Integer userEnabled;
    /**
     * 用户头像icon
     */
    @Column(name = "USER_IMAGE")
    private String userImage;
    /**
     * 邮箱
     */
    @Column(name = "USER_EMAIL")
    private String userEmail;
    /**
     * 是否锁定
     */
    @Column(name = "IS_LOCK")
    private Integer isLock;
    /**
     * 锁定时间
     */
    @Column(name = "LOCK_DATE")
    private Date lockDate;

}